package com.diver.flinkdemo.utils.Trd;

import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;
import com.diver.flinkdemo.service.IHttpService;
import com.diver.flinkdemo.service.impl.HttpServiceImpl;
import lombok.extern.slf4j.Slf4j;


/**
 * @author hesc
 */
@Slf4j
public class YzhRequestUtil {
    public String post(String url, JSONObject params){
//        Map<String, Object> map = (Map<String, Object>) JSON.parse(params.toJSONString());
//        String url1 = HttpUtil.urlWithForm(BASE_URL + url, m, Charset.defaultCharset(), false);
//        String pa = "BAT=54&DEVICENUM=865609040000881&GPS=3&LA=29.5497321q&LO=106.510284q&LOCTIME=2020-09-02 00:00:43&POSDESC=重庆天地" +
//                "&TIMESTAMP=1598500601&TYPE=1&SIGN=F2E643F50E4AA7F5D972A778C0593732&GSM=5";
//        String paramsStr = HttpUtil.toParams(map);
        String result = HttpRequest.post(url).header("Content-Type", "application/json;charset=utf-8").body(params.toJSONString()).execute().body();

//        String result = HttpUtil.post(url, paramsStr);
        log.info("url:{}, 参数：{}, 结果: {}", url, params, result);
        return result;
    }
}
